C++ Online Compiler
Example: C++ Program to Find Power of a Number using pow() Function
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ Program to Find Power of a Number using pow() Function #include <iostream> #include <cmath> using namespace std; // cmath header file loaded to call the pow() function int main() { double b, x, r; // b - Value of the base number // x - Value of the exponent number // r - Value of the result value cout << "-----Enter the input of base number-----\n"; cin >> b; cout << "\n-----Enter the input of exponent number-----\n"; cin >> x; r = (double) pow(b, x); cout << "\nThe calculation of the power of N number is " << b << "^" << x << " = " << r << "\n"; return 0; }
6.4 3.5
Output
Clear
ADVERTISEMENTS